package com.itrip.itripauth.config;

import com.itrip.itripauth.service.HotelOrderService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author: 罗坤
 * @description: 定时任务
 * @date: 2020/3/16 15:00
 */
@Component
public class ScheduledConfig {


    @Resource
    private HotelOrderService hotelOrderService;

    /**
     * 每2小时，进行检查,自动取消待支付的订单并增加库存(测试时间自定)
     */
    @Scheduled(fixedDelay = 60000 ) //每一秒运行一次
    public void orderCancellation(){
//       System.out.println("111111");
       hotelOrderService.timedCancellation();
    }

}
